package com.smedi.ismedi.inmail.api.feign;

import com.smedi.ismedi.authority.starter.request.ValidGroup;
import com.smedi.ismedi.inmail.api.dto.request.MessagesSendRequest;
import com.smedi.ismedi.inmail.api.dto.request.QueryListMessageRecordRequest;
import com.smedi.ismedi.inmail.api.dto.request.QueryPageMessageRecordRequest;
import com.smedi.ismedi.inmail.api.dto.response.MessageRecordResponse;
import com.smedi.ismedi.web.starter.common.PaginationData;
import com.smedi.ismedi.web.starter.common.ResponseData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author u
 */
@Validated
@RestController
@FeignClient("ismedi-inmail")
@Api(tags = "站内信接口")
@RequestMapping(value = "/api/v1/Message")
public interface RemoteMessageFeignApi {
    @ApiOperation(httpMethod = "POST", value = "推送消息")
    @PostMapping("/sendMessage")
    ResponseData<List<MessageRecordResponse>> postSendMessage(@Validated(ValidGroup.Add.class) @RequestBody MessagesSendRequest messagesSendRequest);

    @ApiOperation(httpMethod = "GET", value = "消息列表分页")
    @GetMapping("/queryPageMessage")
    ResponseData<PaginationData<MessageRecordResponse>> getQueryPageMessage(@Validated @SpringQueryMap QueryPageMessageRecordRequest queryPageMessageRecordRequest);

    @ApiOperation(httpMethod = "GET", value = "消息列表")
    @GetMapping("/queryListMessage")
    ResponseData<List<MessageRecordResponse>> getQueryListMessage(@Validated @SpringQueryMap QueryListMessageRecordRequest queryListMessageRecordRequest);

    @ApiOperation(httpMethod = "DELETE", value = "删除消息")
    @DeleteMapping("/deleteMessage")
    ResponseData<Boolean> postDeleteMessage(@RequestParam("messageIds") List<Long> ids);

    @ApiOperation(httpMethod = "GET", value = "阅读消息")
    @GetMapping("/readMessage")
    ResponseData<List<MessageRecordResponse>> postReadMessage(@RequestParam("messageIds") List<Long> ids);

    @ApiOperation(httpMethod = "GET", value = "查看消息")
    @GetMapping("/queryMessage")
    ResponseData<MessageRecordResponse> postQueryMessage(@RequestParam("messageId") Long id);
}
